#!/bin/sh

echo "Show AMD Xilinx bare-metal Hello World in split mode"
R5_0=/sys/class/remoteproc/remoteproc0
R5_1=/sys/class/remoteproc/remoteproc1

echo "Make sure the R5s are not running"
echo stop >$R5_0/state 2>/dev/null
echo stop >$R5_1/state 2>/dev/null

echo "Set the firmware to use"
echo split_rpu0.elf >$R5_0/firmware
echo split_rpu1.elf >$R5_1/firmware

echo "Start R5_0, it will print to the main UART"
echo start >$R5_0/state

# sleeps are so you can see what is happening
sleep 5

echo "Start R5_1, it will also print the main UART"
echo start >$R5_1/state

sleep 5

echo "stop and start R5_1 3 times"
for i in 1 2 3; do
    echo stop  >$R5_1/state
    sleep 1
    echo start >$R5_1/state
    sleep 1
done

echo "Now stop both R5s"
echo stop  >$R5_0/state
echo stop  >$R5_1/state


